import logging,HTMLTestRunner_PY3,yagmail

class Tools():
    # 日志
    def Log(self):
        log=logging.basicConfig(level=logging.DEBUG,
                                format='%(levelname)s %(filename)s %(asctime)s %(message)s %(lineno)d',
                                filename=r'D:\zhuangao5\unit_17\Log\jiuxian.log',
                                filemode='w+')
        return log

    # 报告
    def Report(self):
        report = HTMLTestRunner_PY3.HTMLTestRunner(open(r'D:\zhuangao5\unit_17\Report\jiuxian.html', 'wb'),
                                                   title='酒仙网测试报告',
                                                   description='执行了1条用例，成功登录并修改基本信息，已通过')
        return report

    # 邮件
    def Email(self):
        email = yagmail.SMTP(user='2797158038@qq.com',
                             password='dgkutqcwixmidefd',
                             host='smtp.qq.com',
                             port='465')
        email.send(to='2797158038@qq.com',
                   subject='酒仙网测试报告',
                   contents=[r'D:\zhuangao5\unit_17\Log\jiuxian.log',
                             r'D:\zhuangao5\unit_17\Report\jiuxian.html',
                             '执行了1条用例，成功登录并修改基本信息，已通过'])